<?php
//var_dump($_POST)
//$msg=$_POST['mazmun'];
//$user=$_POST['user'];
include ('shuju.php');
class input{
    function post($key){
        $val=$_POST[$key];
        return $val;
    }
}
$input=new input();
$msg=$input->post('mazmun');
$user=$input->post('user');

if($user=='' || $msg=='' ){
    echo '留言内容和用户名不能为空';
    exit;
}
$tim=time();
$sql="INSERT INTO msg (username,contact,time)VALUES('{$user}','{$msg}','$tim')";
$is=$link->query($sql);
if($is){
    header('location:1.php');
}else{
    echo '插入失败';
}

echo $msg;
echo '<hr/>';
echo $user;
?>
